package practise.sort.SortAlgrothim;

/**
 * Created by richard on 5/11/14.
 */
public class SelectSort  extends SortUtil  {
    public static int[] sort(int[] arrays){
        int[] clone = arrays.clone();
        int tmp=0;
        for(int i =0 ; i <arrays.length;i++){
            tmp=i;
            for(int j=i ; j<arrays.length;j++){
                if(clone[tmp]>=clone[j]){
                    tmp=j;
                }
            }
            swap(clone,tmp,i);
        }
        return clone;
    }
}
